﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterALSafa.Master" AutoEventWireup="true"
    CodeBehind="Vouchers.aspx.cs" Inherits="School.Pages.Accounting.Vouchers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <script type="text/javascript">
        $(document).ready(
            $('.AddVoucher a').live('click', function () {
                //window.open(data.attri
                var value = parseFloat($(this).parent().parent().find('.VoucherValue').text());
                var ivalue = parseFloat(prompt("برجاء ادخال القيمة المدفوعة", value));
                
                if (ivalue.toString() == "NaN")
                    alert("برجاء ادخال قيمة صحيحة");
                else if (ivalue > value)
                    alert("القيمة التى ادخلتها اكبر من القيمة المطلوبة و هى : " + value);
                else
                    window.open($(this).attr("href") + "&Paid=" + ivalue.toString(), 'الإيصال', "status=1,height=500,width:500");
                return false;
            })
        );
    </script>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table width="100%">
                <tr>
                    <td style="width: 50%">
                        <table width="100%">
                            <tr>
                                <td width="40%">
                                    المجمع
                                </td>
                                <td>
                                    <asp:DropDownList ID="LstCampuses" runat="server" OnSelectedIndexChanged="LstCampuses_SelectedIndexChanged"
                                        AutoPostBack="True">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td width="40%">
                                    الشهادة
                                </td>
                                <td>
                                    <asp:DropDownList ID="LstCertificates" runat="server" AutoPostBack="True" OnSelectedIndexChanged="LstCertificates_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td width="40%">
                                    المرحلة
                                </td>
                                <td>
                                    <asp:DropDownList ID="LstStages" runat="server" AutoPostBack="True" OnSelectedIndexChanged="LstStages_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td width="40%">
                                    الصف
                                </td>
                                <td>
                                    <asp:DropDownList ID="LstGrades" runat="server" AutoPostBack="True" OnSelectedIndexChanged="LstGrades_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td width="40%">
                                    الطالب
                                </td>
                                <td>
                                    <asp:DropDownList ID="LstStudents" runat="server" OnSelectedIndexChanged="LstStudents_SelectedIndexChanged"
                                        AutoPostBack="True">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td>
                        <table style="width: 100%">
                            <tr>
                                <td style="width: 20%">
                                    رقم امر الدفع
                                </td>
                                <td>
                                    <asp:TextBox ID="TxtOrderNumber" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="بحث" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Panel ID="Panel1" runat="server" Visible="false">
                            <h2>نتائج البحث</h2>
                            <asp:GridView ID="GridView1" runat="server"
                            Width="100%" CssClass="Grid" HeaderStyle-CssClass="GridHeaderFooter" FooterStyle-CssClass="GridHeaderFooter"
                            PagerStyle-CssClass="GridPager" 
                                AlternatingRowStyle-CssClass="GridItemAltername" 
                                AutoGenerateColumns="False" EnableViewState="False">
                                <AlternatingRowStyle CssClass="GridItemAltername" />
                                <Columns>
                                    <asp:BoundField DataField="Student_Number" HeaderText="رقم الطالب" />
                                    <asp:BoundField DataField="Student_Name" HeaderText="اسم الطالب" />
                                    <asp:BoundField DataField="Number" HeaderText="رقم امر الدفع" />
                                    <asp:BoundField DataField="Date" HeaderText="تاريخ أمر الدفع" />
                                    <asp:BoundField DataField="Expense_Name" HeaderText="نوع الإيراد" />
                                    <asp:BoundField DataField="Value" HeaderText="القيمة" ItemStyle-CssClass="VoucherValue" />
                                    <asp:HyperLinkField DataNavigateUrlFields="Number" 
                                        DataNavigateUrlFormatString="VoucherPayment.aspx?Number={0}" Text="دفع" 
                                        Target="_blank" ItemStyle-CssClass="AddVoucher" >
                                    <ItemStyle CssClass="AddVoucher" />
                                    </asp:HyperLinkField>
                                </Columns>
                                <FooterStyle CssClass="GridHeaderFooter" />
                                <HeaderStyle CssClass="GridHeaderFooter" />
                                <PagerStyle CssClass="GridPager" />
                            </asp:GridView>
                            <asp:Label ID="LblNotFound" Visible="false" runat="server" Text="لم يتم العثور على أى اوامر دفع"></asp:Label>
                        </asp:Panel>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
    </asp:Content>
